import {deepFullCopy, messages} from "share/common";
/**
 * Created by Allen on 2018/3/8.
 */
import React from 'react'
import { connect } from 'react-redux'
import menuRoute from 'routes/menuRoute'
import config from 'config'
import { Tabs, Badge, Modal, Button, message, Col, Row, Icon, Spin, Alert, Radio } from 'antd'
import SlideFrame from 'components/slide-frame'
import {SelectDepOrPerson} from 'components/index';

import 'styles/supplier-management/overview/supplier-detail.scss'
import cmbcSetting from 'images/cmbc-setting.png'
import CmbcRule from 'containers/supplier-management/overview/supplier-detail/cmbc-rule'
import baseService from 'share/base.service' ;
import supplierDetailService from 'containers/supplier-management/overview/supplier-detail/supplier-detail.service'
import enableSupplierService from 'containers/supplier-management/overview/enable-service/enable-service.service'
import supplierUtil from 'containers/supplier-management/overview/supplierUtil'
import SupplierCard from 'containers/supplier-management/overview/supplier-detail/supplier-card'
import HeliosHotelDetail from 'containers/supplier-management/overview/supplier-detail/heliosHotel-detail/helios-hotel-detail'
const TabPane = Tabs.TabPane;
const confirm = Modal.confirm;
import Condition from 'components/condition'
const { If } = Condition;

class supplierDetail extends React.Component{
  constructor(props){
    super(props);

    const { supplierName } = this.props.params;
    this.state = {
      reLoading: false,
      loading: true,        //整个页面的loading
      tableLoading: false,   //用户列表表格的loading
      consumeLoading: false, //修改消费类型的loading
      modalVisible: false,   //查看账号的modal显示标识
      failedAccount: false,  //选中的是否全是开户失败或未开户
      showSlideFrame: false, //商务卡侧拉框
      nowCmbcData: {},   //向商务卡侧拉框传递的参数
      searchParams: {},
      department: '',
      endDate: '',
      info: '',
      level: '',
      startDate: '',
      status: '',
      accountInfo: {
        appSecurity: '',
        appKey: '',
        accountID: ''
      },
      checkAccountTitle: '',  //查看账号的modal标题
      vendorInfo: {
        vendorsServiceName: '',
        vendorsServiceStatus: true,
        lable: [{labExplain: '启用'}]
      },
      warning: true,//是否显示顶部的warning
      vendorsService: [],
      data: [],     //用户列表数据
      cmbcData: [], //开通商务卡的用户数据
      selectedRowKeys: [],
      selectedData: [],
      page: 1,
      pageSize: 10,
      pagination: {
        showSizeChanger:true,
        showQuickJumper:true,
        current: 1,
        total: 0
      },
      tabs: [
        {key: 'SERVICESETTING', name: messages('supplier.key178',{arg1:supplierName === 'didi' ? messages('supplier.key104') :
              (supplierName === 'ctrip') ? messages('supplier.key105') :
                (supplierName === 'CMBC') ? messages('supplier.key106') : (supplierName === 'eleme') ? messages('supplier.key107') : ''}/*{arg1}服务设置*/)},
        // {key: 'USERLIST', name: messages('supplier.detail.tabs.user.list')/*用户列表(*/}
      ],
      extraDep: {
        res: [],
        title: messages('supplier.key108'/*请选择*/),//"请选择",
        depClassName: "f-right select-dep-close-wrap",
        className: ["f-right select-dep-close-wrap", "f-right select-dep-close-wrap select-dep-close-wrap-show"]
      },
      searchForm: [
        {type: 'radio', id: 'status', label: messages('supplier.key109'/*开户状态*/),
          options: [
            {label:messages('supplier.key110'/*全部*/),value: ''},
            {label: messages('supplier.key111'/*已启用*/),value: 0},
            {label: messages('supplier.key112'/*未启用*/),value: 1},
            {label: messages('supplier.key113'/*失败*/),value: 2}
          ],
          defaultValue: ''
        },
        {type: 'input', id: 'info', label: messages('supplier.key114'/*员工信息*/),
          placeholder: messages('supplier.key115'/*请输入员工姓名/手机号/工号*/),
          defaultValue: ''},
        {type: 'datePicker', id: 'time', label: messages('supplier.key116'/*开户时间*/), defaultValue: ''},
        {type: 'select', id: 'level', label: messages('supplier.key117'/*员工级别*/),
          getUrl: `${config.baseUrl}/api/custom/enumeration/system/by/type?systemCustomEnumerationType=1008`,
          method: 'get',
          listKey: 'values',
          labelKey: 'messageKey',
          valueKey: 'messageKey',
          options: [],
          placeholder: messages('common.please.select')
        }
      ],
      columns: [
        {title: messages('supplier.key118'/*工号*/),
          key: 'employeeId', dataIndex: 'employeeId',width: '10%'},
        {title: messages('supplier.key119'/*姓名*/),
          key: 'name', dataIndex: 'name',width: '10%'},
        {title: messages('supplier.key120'/*部门*/),
          key: 'department', dataIndex: 'department',width: '10%'},
        {title: messages('supplier.key121'/*手机号*/),
          key: 'mobile', dataIndex: 'mobile',width: '10%'},
        {title: messages('supplier.key122'/*邮箱*/),
          key: 'emailAddress', dataIndex: 'emailAddress',width: '15%'},
        {title: messages('supplier.key117'/*员工级别*/),
          key: 'level', dataIndex: 'level',width: '5%'},
        {title: messages('supplier.key109'/*开户状态*/),
          key: 'vendorList.openCardStatus', dataIndex: 'vendorList.openCardStatus', width: '5%',
        render: (value) => (
          <Badge status={value === '0' ? 'success' : (value === '1' ? 'processing' : (value === '2' ? 'error' : null))}
                 text={value === '0' ? '启用' : (value === '1' ? '未开户' : (value === '2' ? '失败' : ''))} />
        )},
        {title: messages('supplier.key116'/*开户时间*/),
          key: 'vendorList.openCardStartDate', dataIndex: 'vendorList.openCardStartDate',width: '8%', render: (openCardStartDate) => (
          <span>{openCardStartDate}</span>
        )},
        {title: messages('supplier.key123'/*备注*/),
          key: 'vendorList.vendorMessage', dataIndex: 'vendorList.vendorMessage', render: (value) => (
          <span style={{overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth: '50px'}}>{value}</span>
        )}
      ],
      rowSelection: {
        selectedRowKeys: [],
        onChange: this.onSelectChange,
        onSelect: this.onSelectItem,
        onSelectAll: this.onSelectAll
      },
      tabStatus: 'SERVICESETTING',
      vendorsServiceName: '',
      enableService: menuRoute.getRouteItem('enable-service','key'),
      supplierDashboard: menuRoute.getRouteItem('overview','key'),
      editSubApplication: menuRoute.getRouteItem('edit-sub-application', 'key'), //编辑子应用的页面项
      toSetYget: menuRoute.getRouteItem('set-yget', 'key'), //源慧调整额度
      loadingSpin: false,
    };
  }

  componentDidMount(){
    this.initData();
  }

  initData = () => {
    const { supplierName } = this.props.params;
    supplierDetailService.getVendorDetail(supplierName).then(resp => {
      if (resp.status === 200){
        this.setState({
          loading: false,
          vendorInfo: resp.data.body,
          vendorsServiceName: resp.data.body.vendorsServiceName,
          vendorsService: resp.data.body.vendorsService ? resp.data.body.vendorsService : []
        });
      }
    }).catch(error => {
      message.error(messages('common.error'));
    });
    this.otherInitOperator(supplierName)
  };

  // 不同供应商额外的其他初始化操作
  otherInitOperator = (supplierName) => {
    switch (supplierName){
      case 'ctrip': this.ctripCheck();
        break;
      case 'CMBC': this.getCmbcAccount();
        break;
      case 'heliosHotel':
        console.log('zhen xuan jiu dian');
        break;
    }
  }

  getList(){
    const { page, pageSize } = this.state;
    const { supplierName } = this.props.params;
    this.setState({tableLoading: true});
    let searchParams = {
      department: this.state.department,
      endDate: this.state.endDate,
      info: this.state.info,
      level: this.state.level,
      startDate: this.state.startDate,
      status: this.state.status,
    };
    supplierDetailService.getUserList(searchParams,page,pageSize,supplierName).then((resp) => {
      if (resp.status === 200){
        resp.data.datas.map((item) => {
          item.key = item.id;
        });
        this.setState({
          tableLoading: false,
          data: resp.data.datas,
          pagination: {
            current: this.state.page,
            total: resp.data.count,
            onChange: this.onChangePager
          }
        })
      }
    }).catch(error => {
      this.setState({tableLoading: false});
      message.error(messages('common.error'));
    })
  }

  //获取商务卡开户数据
  getCmbcAccount(){
    enableSupplierService.getCMBCAccount().then(resp => {
      if (resp.status === 200){
        this.setState({cmbcData: resp.data.rows.tenantBankCardCfgList})
      }
    }).catch(error =>
      message.error(messages('common.error'))
    )
  }

  // 携程查看账号
  ctripCheck = () => {
    const { supplierName } = this.props.params;
    supplierDetailService.checkAccount(supplierName).then(resp => {
      if (resp.status === 200){
        this.setState({accountInfo: resp.data});
      }
    }).catch(error => message.error(messages('common.error')))
  }

  //分页点击
  onChangePager = (page) => {
    if (page  !== this.state.page)
      this.setState({
        tableLoading: true,
        page: page
      }, ()=>{
        this.getList();
      })
  };

  //全选当页
  onSelectAll = (selected,selectedRows,changeRows) => {
    changeRows.map(changeRow => this.onSelectItem(changeRow,selected))
  };

  onSelectChange = (selectedRowKeys) => {
    let { rowSelection } = this.state;
    rowSelection.selectedRowKeys = selectedRowKeys;
    this.setState({ rowSelection });
  };

  onSelectItem = (record,selected) => {
    let failedArray = [];
    const { selectedData, failedAccount } = this.state;
    if (!selected){
      selectedData.map((item,index) => {
        if (item.id === record.id){
          selectedData.splice(index,1);
        }
      })
    } else {
      selectedData.push(record)
    }
    this.setState({selectedData},() => {
      selectedData.map(item => {
        if(item.vendorList && item.vendorList.openCardStatus === '1' || item.vendorList && item.vendorList.openCardStatus === '2'){
          failedArray.push(0);
        }else {
          failedArray.push(1);
        }
      });
      if (failedArray.includes(1)){
        this.setState({failedAccount: false});
      }else {
        this.setState({failedAccount: true});
      }
    });
  };


  handleSearch = (values) => {
    values.startDate = values.time ? values.time[0].format('YYYY-MM-DD') : '';
    values.endDate = values.time ? values.time[1].format('YYYY-MM-DD') : '';
    let searchParams = {
      department: this.state.department,
      endDate: values.endDate,
      info: values.info,
      level: values.level,
      startDate: values.startDate,
      status: values.status,
    };
    this.setState({
      endDate: values.endDate,
      info: values.info,
      level: values.level ? values.level : '',
      startDate: values.startDate,
      status: values.status
    });
    this.setState({
      searchParams: searchParams,
      page: 1,
      pageSize: 10,
    },() => {
      this.getList()
    })
  };


  //关闭服务
  closeService = () => {
    const { supplierName } = this.props.params;
    const { history } = this.props;
    let option = supplierUtil.getTipMessage(supplierName);
    let cancellationAuthorization = this.cancellationAuthorization;
    let that = this;
    let enableService = this.state.enableService;
    let vendorsServiceName = this.state.vendorsServiceName;
    const closeModal = confirm({
      title: option.title,
      content: option.confirmContent,
      okText: messages('supplier.key100'/*继续关闭*/),
      onOk() {
        if(supplierName === 'didi'){
          cancellationAuthorization();// 跳转取消授权页面
        }
        supplierDetailService.closeService(option.serviceId).then(resp => {
          closeModal.destroy();
          that.setState({
            warning: true,
          });
          let path = enableService.url.replace(':supplierName', supplierName).replace(':supplierChinaName', vendorsServiceName);
          that.context.router.push(path)
        })
      },
      onCancel() {},
    })
  };

  // 滴滴跳转取消授权
  cancellationAuthorization = () => {
    const { companyOID, name } = this.props.company;
    let params = {
      "outCompanyId": companyOID,
      "outCompanyName":name,
      "outMemberId":this.props.user.userOID,
      "authScope":'1|2|3',
      "callBack":"applyType=pc"
    };
    enableSupplierService.getToken(companyOID,params).then(resp => {
      if (resp.data.errno === '0'){
        let token = resp.data.data.open_auth_token;
        window.open(`http://api.es.xiaojukeji.com/openauth/Platform/index?open_auth_token=${token}`);
      }else {
        message.error(resp.data.errmsg);
      }
    })
  }

  //供应商权限小卡片操作
  cardActions = (configCode, item) => {
    switch (configCode){
      case '9001': {  //提前审批服务
        this.approveBefore();
       break;
      }
      case '9003': {    //开票二次确认

        break;
      }
      case '9004': {     //开票资质
        // window.open('http://es.xiaojukeji.com/web/manage/quality.html', '_blank');
        window.open('https://es.xiaojukeji.com/platform/invoice/title', '_blank');
        break;
      }
      case '9100': // 携程机票
      case '9101': // 携程酒店
      case '9102': // 携程火车
      case '9103': // 携程用车
        item.configStatus = !item.configStatus;
        this.setState({loadingSpin: true});
        supplierDetailService.enableCtripServer(item).then(res => {
          if(res.data.code === '0000' || res.data.msg === 'succeed'){
            const { supplierName } = this.props.params;
            supplierDetailService.getVendorDetail(supplierName).then(resp => {
              if (resp.status === 200){
                this.setState({
                  loadingSpin: false,
                  vendorInfo: resp.data.body,
                  vendorsService: resp.data.body.vendorsService ? resp.data.body.vendorsService : []
                });
              }
            }).catch(error => {
              message.error(messages('common.error'));
              this.setState({loadingSpin: false});
            });
          }
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
    }
  };

  //提前审批服务
  approveBefore(){
    const { profile, company } = this.props;

    let authorizeType = 1;
    profile['ctrip.ahead.approval'] = !profile['ctrip.ahead.approval'];
    profile['ctrip.ahead.approval'] ? authorizeType = 1 : authorizeType = 2;
    let params = {
      authorizeType: authorizeType,
      companyOID: company.companyOID
    };
    let changeProfile = {
      companyOID:null,
      entityOID:this.props.company.companyOID,
      entityType:1003,
      profileDetail:profile,
    }
    supplierDetailService.setFunctionProfile(changeProfile).then(resp => {

    });
    supplierDetailService.modifyCtripService(params).then(resp => {
      if (resp.status === 200){
        message.success(messages('supplier.key154'/*保存成功*/))
      }
    }).catch(error => message.error(messages('common.error')))
  };

  //前往商务卡设置
  goToSetting = () => {
    this.setState({
      showSlideFrame: true,
      reLoading: true,
      nowCmbcData:{
        cmbcData: this.state.cmbcData,
      }
    })
  };

  cmbcRuleDataonChange = (data) => {
    this.setState({cmbcData: deepFullCopy(data)})
  }

  //关闭侧拉框之后
  handleCloseSlide = () => {
    this.setState({showSlideFrame : false,reLoading:false});
    /*this.getCmbcAccount();*/
  };

  //查看账号
  checkAccount = (supplierName) => {

    switch (supplierName){
      case 'didi': {
        this.setState({checkAccountTitle: messages('supplier.key155'/*查看滴滴账号*/)});
        break;
      }
      case 'ctrip': {
        this.setState({checkAccountTitle: messages('supplier.key156'/*查看携程账号*/)});
        break;
      }
    }
    this.setState({modalVisible: true});
  };

  //关闭查看账号的modal
  handleCancel = () => {
    this.setState({modalVisible: false});
  };

  //返回
  handleBack = () => {
    this.context.router.push(`${this.state.supplierDashboard.url}`)
  };

  //Tabs点击
  onChangeTabs = (key) => {
    this.setState({
      tabStatus: key
    },()=>{
      this.getList()
    });
  };

  //渲染Tabs
  renderTabs(){
    return (
      this.state.tabs.map(tab => {
        return <TabPane tab={tab.name} key={tab.key}/>
      })
    )
  }

  renderLabel(){
    const { vendorsService } = this.state;

    return vendorsService.map((item,index) => (
      <Col span={8} key={item.configCode}>
        {item.configname}：
        {item.configType === 'switch' ?
          (item.configStatus === true ?
            messages('supplier.key111'/*已启用*/) :
            messages('supplier.key157'/*未启用*/)) :
          (item.configStatus === true ?
            messages('supplier.key158'/*已设置*/) :
            messages('supplier.key159'/*未设置*/))}
        </Col>
    ))
  };

  renderCards(){
    const { vendorsService } = this.state;

    return vendorsService.map(item => (
      <Col span={8} key={item.configCode}>
        <SupplierCard cardOption={item} callBack={{func:this.cardActions}}/>
      </Col>
    ))
  }

  toSetYget = () => {
    const { toSetYget } = this.state;
    this.context.router.push(toSetYget.url);
  }

  //跳转到编辑子应用详情页
  goEditSubApplication = (e, appCode) => {
    this.context.router.push({
      pathname: this.state.editSubApplication.url,
      state: {
        appCode,
      },
    });
  };

  //修改商务卡消费记录属性
  handleConsumeTypeChange = (e) => {
    let params = {
      "scope": "company",
      "profiles": [
        {
          key: 'biz.card.expenses.forces.companies.to.pay',
          value: e.target.value
        }
      ]
    };
    this.setState({ consumeLoading: true });
    supplierDetailService.updateConsumeType(params).then(() => {
      baseService.getProfile().then(() => {
        this.setState({ consumeLoading: false });
      });
      message.success(messages('common.operate.success'))
    }).catch(e => {
      message.error(e.response.message)
    })
  };

  render(){
    const { profile } = this.props;
    const { tabStatus, vendorInfo, modalVisible, consumeLoading, loadingSpin,
      checkAccountTitle, accountInfo, showSlideFrame, nowCmbcData, loading, reLoading, warning } = this.state;
    const { supplierName } = this.props.params;
    const message = (
      <Row>
        <Col span={23}> {messages('supplier.key179',{arg1:vendorInfo.vendorsServiceName})/*您已开通{arg1}，请前往【APP应用管理】页面*/}：
        </Col>
        <Col span={1} onClick={() => {this.setState({warning: false})}} style={{textAlign: 'right', cursor: 'pointer'}}>X</Col>
      </Row>
    );
    const description = (
      <div>
        <Row span={20} style={{marginBottom: 5}}>1、{messages('supplier.key180')/*将应用状态设置为【启用】*/}</Row>
        <Row span={20} style={{marginBottom: 5}}>2、{messages('supplier.key181')/*用户才可在【APP-应用】界面看到该应用*/}</Row>
      </div>
    );

    return (
      <div className="supplier-detail">
        {loading ? <Spin style={{width: '100%', lineHeight: '500px'}}/> : (
          <div>
            {
              warning ?
                <div style={{marginBottom: 20}}>
                  <Alert
                    message={message}
                    description={description}
                    type="warning"
                    showIcon
                  />
                </div>
                : null
            }
            <div className="supplier-detail-head">
              <div className="supplier-picture">
                <img src={vendorInfo.icoUrl} alt=""/>
              </div>
              <div className="supplier-info-content">
                <div className="supplier-name">
                  {vendorInfo.vendorsServiceName}
                  {vendorInfo.lable.map((item,index) => (
                    <span className="open-status" key={index}>{item.labExplain}</span>
                  ))}
                </div>
                <div className="head-jurisdiction-info">
                  <Row className="label-row">
                    {supplierName !== 'CMBC' && (
                      <div>
                        {this.renderLabel()}
                      </div>
                    )}
                    {supplierName === 'CMBC' && (
                      <div>
                        <Col span={8}>
                          {messages('supplier.key160'/*账号设置*/)}：{messages('supplier.key158'/*已设置*/)}
                        </Col>
                      </div>
                    )}
                  </Row>
                </div>
                {supplierName === 'ctrip' && (
                  <div>
                    <a onClick={() => this.checkAccount(supplierName)}>
                      {messages('supplier.key156'/*查看携程账号*/)}
                    </a>
                  </div>)}

                {/*查看账号的modal*/}
                <Modal
                  title={checkAccountTitle}
                  visible={modalVisible}
                  onCancel={this.handleCancel}
                  footer={[
                    <Button key="close" type="primary" onClick={() =>this.handleCancel()}>
                      {messages('supplier.key161'/*关闭*/)}</Button>
                  ]}>
                  {supplierName === 'ctrip' && (
                    <div style={{lineHeight: '32px'}}>
                      <div>
                        {messages('supplier.key162'/*携程服务*/)} ({accountInfo.bigCus ? messages('supplier.key163'/*大客户*/) : messages('supplier.key164'/*小客户*/)})
                      </div>
                      <div>
                        APPSECRET: &nbsp;&nbsp;{accountInfo.appSecurity}
                      </div>
                      <div>APPKEY:  &nbsp;&nbsp;{accountInfo.appKey}</div>
                      <div>ACCOUNTID:&nbsp;&nbsp;  {accountInfo.accountID}</div>
                    </div>
                  )}
                  {supplierName === 'didi' && (
                    <div>
                      <div>APPKEY: &nbsp;&nbsp; {accountInfo.appKey}</div>
                      <div>APPSECRET: &nbsp;&nbsp; {accountInfo.appSecurity}</div>
                    </div>
                  )}
                </Modal>
              </div>
              <div className="right-button">
                <Button className="close-button" onClick={() => this.closeService()}>
                  {messages('supplier.key165'/*关闭服务*/)}
                </Button>
              </div>
            </div>
            <If value={supplierName === 'CMBC'}>
              <Spin spinning={consumeLoading}>
                <div>
                  {messages('supplier.key477')/*商务卡消费记录属性*/}：
                  <Radio.Group
                    value={profile['biz.card.expenses.forces.companies.to.pay'] || 1001}
                    onChange={this.handleConsumeTypeChange}
                  >
                    <Radio value={1001}>{messages('supplier.key478')/*个人支付*/}</Radio>
                    <Radio value={1002}>{messages('supplier.key479')/*公司支付*/}</Radio>
                  </Radio.Group>
                </div>
                <div>（{messages('supplier.key480')/*说明：当商务卡消费记录属性="公司支付"时，所有关联商务卡消费记录的费用会是公司支付*/}）</div>
              </Spin>
            </If>
            {(supplierName === 'ctrip' || supplierName === 'didi') && (
              <div>
                <div className="supplier-detail-tabs">
                  <Tabs onChange={this.onChangeTabs}>
                    {this.renderTabs()}
                  </Tabs>
                </div>
                <Spin spinning={loadingSpin}>
                  {tabStatus === 'SERVICESETTING' && (
                    <div className="service-setting">
                      <Row gutter={8} className="card-items">
                        {this.renderCards()}
                      </Row>
                    </div>
                  )}
                </Spin>
              </div>
            )}

            {supplierName === 'CMBC' && (
              <div className="service-setting">
                <div className="supplier-detail-tabs">

                </div>
                <Row gutter={8} className="card-items">
                  <Col span={8}>
                    <div className="card-style">
                      <div className="card-head">
                        <div className="card-img">
                          <img src={cmbcSetting} alt=""/>
                        </div>
                        <div className="card-text">
                          <div className="title">{messages('supplier.key167'/*设置账号及逾期规则*/)}</div>
                          <div className="content">{messages('supplier.key168'/*设置后系统将在报销期限日凌晨检查未审核通过的费用或商务卡消费，并标记为已逾期*/)}</div>
                        </div>
                      </div>
                      <div className="card-footer">
                        <Badge status="success" text={messages('supplier.key158'/*已设置*/)} />
                        <a className="config-explain" onClick={this.goToSetting}>
                          {messages('supplier.key169'/*前往设置*/)}
                        </a>
                      </div>
                    </div>
                  </Col>
                </Row>
                <SlideFrame content={CmbcRule}
                            title={messages('supplier.key167'/*设置账号及逾期规则*/)}
                            show={showSlideFrame}
                            width="85%"
                            onClose={()=>this.setState({showSlideFrame:false})}
                            afterClose={this.handleCloseSlide} params={{nowCmbcData,reLoading, supplierName,cmbcRuleDataonChange:this.cmbcRuleDataonChange}}/>
              </div>
            )}

            {supplierName === 'yget' && (
              <div className='service-setting'>
                <div className='card-items' style={{maxWidth:'33%',marginTop:-48}}>
                  <SupplierCard cardOption={{
                    configname:messages('supplier.key212')/*调整额度*/,
                    configIntroduction:messages('supplier.key213')/*一次性调整额度*/,
                    configStatus:true,
                    configTypeExplain:messages('supplier.key169'/*前往设置*/),
                    configIco:cmbcSetting,
                    configType:'text',
                  }} callBack={{func:this.toSetYget}}
                  />
                </div>
              </div>
            )}

            { supplierName === 'heliosHotel' && <HeliosHotelDetail /> }

            <a className={supplierName === 'yget' ? 'back-button-yget':'back-button'} onClick={this.handleBack}>
              <Icon type="rollback" style={{marginRight:'5px'}}/>{messages('common.back')}
            </a>
          </div>
        )}
      </div>
    )
  }
}

supplierDetail.contextTypes = {
  router: React.PropTypes.object
};

function mapStateToProps(state) {
  return {
    profile: state.login.profile,
    company: state.login.company,
    user: state.login.user
  }
}

export default connect(mapStateToProps)(supplierDetail)
